home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Online / hsc / docs-source / macro / attrib.hsc next >
Encoding:
Text File  |  1997-10-10  |  3.5 KB  |  105 lines

  1. <WEBPAGE chapter="hsc - Features - Macros - "
  2.          PREV="flag.html"
  3.          NEXT=":features/if.html"
  4.          title="Attribute Declaration">
  5.  
  6. <$macro LITYPE TYPE:string/r>
  7. <DT><CODE><(type)></CODE>
  8. <DD>
  9. </$macro>
  10.  
  11. <$macro LIATTR SHORT:string/r LONG:string/r>
  12. <DT><CODE>/<(long)></CODE>
  13.     (short: <CODE>/<(short)></CODE>)
  14. <DD>
  15. </$macro>
  16.  
  17. <*
  18. ** macro to format an example
  19. *>
  20. <$macro exmpl exmpl:string/r>
  21. <DT><CODE><(exmpl)></CODE>
  22. <DD>
  23. </$macro>
  24.  
  25. <P>Attributes are comparable to function arguments in programming languages
  26. like Pascal, Oberon or E. So attributes are arguments passed to a tag or
  27. macro.</P>
  28.  
  29. <P>Additionally, you can create/update attributes using <ln_define>
  30. and <ln_let> therefor using them like variables.</P>
  31.  
  32. <H2>General Syntax</H2>
  33.  
  34. Within <ln_macro>, <ln_define> and <ln_deftag>,
  35. an  attribute is declared using
  36. <BLOCKQUOTE>
  37. <I>name</I> ":" <I>type</I>  [ "/" <I>modifiers</I> ]  [ "=" <I>default value</I> ]
  38. </BLOCKQUOTE>
  39.  
  40. <H2><A NAME="type">Attribute Types</A></H2>
  41. <DL>
  42. <LITYPE type="STRING"> any text
  43. <LITYPE type="URI"> references to an URI. Is affected by CLI
  44.     options like <op_stripexternal>.
  45. <LITYPE type="BOOL"> boolean flag
  46. <LITYPE type="ENUM"> enumerator type; accepts only given values (eg the
  47.     <CODE>ALIGN</CODE>
  48.     attribute of <TG>IMG</TG>).
  49. <LITYPE type="ID"> id for current position in document; can be refered
  50.   with <TG>A HREF="#id"</TG>
  51. <LITYPE type="NUM"> decimal integer value
  52. <LITYPE type="COLOR"> a color-value matching the template <CODE>"#rrggbb"</CODE>
  53.  or one of the values defined using 
  54. <A HREF=":features/spcattr.html#colornames"><CODE>HSC.COLOR-NAMES</CODE></A>.
  55. </DL>
  56.  
  57. <H2><A NAME="modifier">Attribute Modifiers</A></H2>
  58. <DL>
  59. <LIATTR LONG="CONST" SHORT="C">
  60.     Attribute is read-only; you can't set a new value using <ln_let>.
  61.     This option is only allowed within <ln_define>
  62. <LIATTR LONG="GLOBAL" SHORT="G">
  63.     Attribute is global. Useful if you want to define an attribute inside
  64.     a macro, that is not removed after macro has been processed.
  65.     This option is only allowed within <ln_define>.
  66. <LIATTR long="JERK" short="J">
  67.     Attribute is only used by a <jerk>.
  68. </DL>
  69.  
  70. Within <ln_macro> and <ln_deftag>, URIs also can have the following options:
  71.  
  72. <DL>
  73. <LIATTR long="REQUIRED" short="R">
  74.     Attribute must be set with a value when macro/tag is called.
  75. <LIATTR long="SIZE" short="Z">
  76.     If the attribute references to a local file, try to evaluate
  77.     the "size" of the file, search for attributes called
  78.     <CODE>WIDTH</CODE> and <CODE>HEIGHT</CODE> within the same tag
  79.     and set them with these values (if they have not been set before).
  80.     At they moment, only tags like <TG>IMG</TG> support this.
  81. <LIATTR long="STRIPEXT" short="X">
  82.     Strip whole tag, if the attribute references to an external URI
  83.     and option <op_stripexternal> has been enabled.
  84. </DL>
  85.  
  86. <H2>Default Value</H2>
  87. <P>The default value initialises the attribute every time the
  88. macro is called. If the attribute is not set within the macro call, the
  89. default value is used. Otherwise, the value passed to the macro
  90. will be used as new value.</P>
  91.  
  92. <H2>Examples</H2>
  93. <DL>
  94. <EXMPL exmpl="DO-IT:bool">
  95.     defines a boolean attribute
  96. <EXMPL exmpl='UP:uri=":main.html"'>
  97.     defines an URI attribute and sets it's default value to "<CODE>:main.html</CODE>".
  98.     The ":" indicates that the default value is a <fe_prjuri>.
  99. <EXMPL exmpl='MODE:enum("ascii|bin|hex")'>
  100.     defines an enumerator type; allowed values are <CODE>ascii</CODE>,
  101.     <CODE>bin</CODE> and <CODE>hex</CODE>.
  102. </DL>
  103.  
  104. </WEBPAGE>
  105.